package imp.haemers.data.vo 
{
	import flash.utils.describeType;
	import flash.utils.Dictionary;
	import nl.haemers.utils.ObjectReader;
	/**
	 * ...
	 * @author Jonathan
	 */
	public class CoreVO extends Object
	{
		private var _props:Vector.<String>;
		
		public function CoreVO() 
		{
			_props = new Vector.<String>();
		}
		
		/** Public methods **/
		//
		//public function toString():String
		//{
			//var string:String = "";
			//for each(var prop:String in _props)
			//{
				//string = createString(string, this, key);
			//}
			//
			///*
			//var type:XML = describeType(this);
			 //var props:XMLList = type.variable;
//           
			//output(props);
//
			//props = type.accessor;
//            output(props);
			//*/
//
			//string = new ObjectReader().readObject(this);
			//
			//return string;
		//}
		//
		private function output(props:XMLList):void
		{
			for (var i:int = 0; i <props.length(); i++)
            {
                trace("\t" + props[i].@name + ":" + props[i].@type + " = " + this[props[i].@name]);
            }
		}
		/** Getters & Setters **/
		
		/** Protected methods **/
		protected function addToString(...args):void
		{
			if (args)
			{
				var len:int = args.length;
				for (var i:int = 0; i < len; i++)
				{
					_props.push(args[i]);
				}
			}
		}
		/** Private methods **/
		/*
		 private function createString(string:String, object:Object, prop:String) : String
		{
			if (object[prop] is CoreVO)
			{
				string += "\nObject " + prop + ": " + object[prop].toString() + "\n---";
			}
			else if (object[prop] is Array)
			{
				return createArrayString(string, object[prop], prop);
			}
			else if (object[prop] is Dictionary)
			{
				return createDictString(string, object[prop], prop);
			}
			else
			{
				string += "\n" + prop + ": " + object[prop];
			}
			
			return string;
		}
		
		private function createArrayString(string:String, object:Object, prop:String) : String
		{
			string += "\nArray " + prop + ":";
			for (var i:int = 0; i < object.length; i++)
			{
				string += "\n Index: " + i + ": " + object[i];
				for (var key:String in object[i])
				{
					string += createString(string, object[i], key);
					//string += "\n" + key + ": " + object[prop][i][key];
				}
			}
			
			return string;
		}
		
		private function createDictString(string:String, object:Object, prop:String) : String
		{
			string += "\nDictionary " + prop + " ";
			for (var key:String in object)
			{
				//string += "\nKey: " + key;
				string += createString(string, object, prop);
			}
			return string;
		} 
		 */
	}

}